package com.yudedu.hospital.test;


import java.util.Set;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import javax.validation.groups.Default;

import org.apache.ibatis.annotations.Update;
import org.junit.Test;

import com.yudedu.hospital.entity.UserLogin;


public class ValidFramwork {

	@Test
	public void test() {
		ValidatorFactory factory =  Validation.buildDefaultValidatorFactory();
		Validator validator = factory.getValidator();
		
		UserLogin user = new UserLogin();
		user.setPassword("1234");
		
		 
		
		Set<ConstraintViolation<UserLogin>> res = validator.validate(user,Default.class, Update.class);
		for(ConstraintViolation<UserLogin> cv:res) {
			System.out.println(cv.getPropertyPath());
			System.out.println(cv.getMessage());
		}
		
		
	}

}
